﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations.Schema;
using LunwenYun.Infrastructure.Entities.Enum;
using LunwenYun.Infrastructure.Entities.Repository;

namespace LunwenYun.Infrastructure.Entities.Entity
{
    public class PaperAgentInfo : IAccessible<T_PaperAgentInfo, PaperAgentInfo>, ILogicEntity<T_PaperAgentInfo, PaperAgentInfo>
    {
        #region
        public string Username { get; set; }
        /// <summary>
        /// 约稿人称呼
        /// </summary>
        public string Name { get; set; }

        public string Introduction { get; set; }

        public AccountType AccountType { get; set; }

        public string AccountNo { get; set; }

        /// <summary>
        /// 约稿声明
        /// </summary>
        public string Declaration { get; set; }

        public string QQ { get; set; }

        public string Phone { get; set; }

        /// <summary>
        /// 接收推送邮箱
        /// </summary>
        public string Email { get; set; }

        public DateTime RcdDate { get; set; }
        public DateTime RefreshDate { get; set; }
        #endregion

        protected override void Covariant(T_PaperAgentInfo model)
        {
            if (model != null)
            {
                this.Username = model.Username;
                this.AccountNo = model.AccountNo;
                this.AccountType = (AccountType)model.AccountType;
                this.Declaration = model.Declaration;
                this.Email = model.Email;
                this.Introduction = model.Introduction;
                this.Name = model.Name;
                this.Phone = model.Phone;
                this.QQ = model.QQ;
                this.RcdDate = model.RcdDate;
                this.RefreshDate = model.RefreshDate;
            }
        }

        protected override T_PaperAgentInfo Inverter(PaperAgentInfo model)
        {
            if (model != null)
            {
                return new T_PaperAgentInfo()
                {
                    Username=model.Username,
                    AccountNo = model.AccountNo,
                    AccountType = (int)model.AccountType,
                    Declaration = model.Declaration,
                    Email = model.Email,
                    Introduction = model.Introduction,
                    Name = model.Name,
                    Phone = model.Phone,
                    QQ = model.QQ,
                    RcdDate = model.RcdDate,
                    RefreshDate = model.RefreshDate
                };
            }
            return null;
        }

        public PaperAgentInfo Set(T_PaperAgentInfo dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
